package pct.manage;

import java.util.Calendar;
import java.util.LinkedList;

import pct.entity.Group;
import pct.entity.Post;
import pct.entity.Topic;
import pct.entity.User;

/*
 * StatusManager
 * The snapshot of the current active user
 * Contains:
 * 1. Current user [User]
 * 2. Groups he join [List(Group)]
 * 3. Topics under the group he enters [List(Topic)]
 * 4. Posts under the topic he enters [List(Post)]
 * 5. MessageBox he owns [MessageBox]
 */
public class StatusManager {
	// record currentUser
	private User currentUser;
	private int year;
	private int month;
	// record all the groups user has joined
	private LinkedList<Group> relatedGroups;
	
	// record which group user clicked
	private String currentGroupName;
	// record all the topics below the group which user clicked
	private LinkedList<Topic> relatedTopics;
	
	// record which topic user clicked
	private Topic currentTopic;
	// record which topic ID user clicked
	private int currentTopicID;
	// record all the posts below the topic which user clicked
	private LinkedList<Post> relatedPosts;
	
	private LinkedList<User> relatedUsers;

	// record current page number
	private int currentPage = 0;
	// record total page size
	private int pageSize = 0;
	
	
	// record all matching groups user searched
	private LinkedList<Group> searchedGroups;
	// record all matching topics user searched
	private LinkedList<Topic> searchedTopics;
	// record all matching posts user searched
	private LinkedList<Post> searchedPosts;
	
	private LinkedList<Group> searchedDisease;
	
	// record which page type user is in. 
	// page type: 1 [viewing groups], 2 [viewing topics], 3 [viewing posts]
	//   		  4 [viewing groups by search], 5 [viewing topics by search], 6 [viewing posts by search]
	private int pageType;
	
	private boolean joined;
	
	public LinkedList<User> getRelatedUsers() {
		return relatedUsers;
	}

	public void setRelatedUsers(LinkedList<User> relatedUsers) {
		this.relatedUsers = relatedUsers;
	}
	public int getCurrentTopicID() {
		return currentTopicID;
	}

	public void setCurrentTopicID(int currentTopicID) {
		this.currentTopicID = currentTopicID;
	}

	public Topic getCurrentTopic() {
		return currentTopic;
	}

	public void setCurrentTopic(Topic currentTopic) {
		this.currentTopic = currentTopic;
	}

	public String getCurrentGroupName() {
		return currentGroupName;
	}

	public void setCurrentGroupName(String currentGroupName) {
		this.currentGroupName = currentGroupName;
	}

	public User getCurrentUser() {
		return currentUser;
	}

	public void setCurrentUser(User currentUser) {
		this.currentUser = currentUser;
		if (currentUser.getBirthday()!=null){
		year=currentUser.getBirthday().get(Calendar.YEAR);
		month=currentUser.getBirthday().get(Calendar.MONTH);
		}
	}

	public LinkedList<Group> getRelatedGroups() {
		return relatedGroups;
	}

	public void setRelatedGroups(LinkedList<Group> relatedGroups) {
		this.relatedGroups = relatedGroups;
	}

	public LinkedList<Topic> getRelatedTopics() {
		return relatedTopics;
	}

	public LinkedList<Post> getRelatedPosts() {
		return relatedPosts;
	}

	public void setRelatedPosts(LinkedList<Post> relatedPosts) {
		this.relatedPosts = relatedPosts;
	}

	
	public void setRelatedTopics(LinkedList<Topic> relatedTopics) {
		this.relatedTopics = relatedTopics;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPageType() {
		return pageType;
	}

	public void setPageType(int pageType) {
		this.pageType = pageType;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public LinkedList<Post> getSearchedPosts() {
		return searchedPosts;
	}

	public void setSearchedPosts(LinkedList<Post> searchedPosts) {
		this.searchedPosts = searchedPosts;
	}

	public LinkedList<Group> getSearchedGroups() {
		return searchedGroups;
	}

	public void setSearchedGroups(LinkedList<Group> searchedGroups) {
		this.searchedGroups = searchedGroups;
	}
	
	public LinkedList<Group> getSearchedDisease() {
		return searchedDisease;
	}

	public void setSearchedDisease(LinkedList<Group> searchedDisease) {
		this.searchedDisease = searchedDisease;
	}

	public LinkedList<Topic> getSearchedTopics() {
		return searchedTopics;
	}

	public void setSearchedTopics(LinkedList<Topic> searchedTopics) {
		this.searchedTopics = searchedTopics;
	}

	public void setYear(int year){
		this.year=year;
	}

	public int getYear(){
		return this.year;
	}

	public void setMonth(int month){
		this.month=month;
	}

	public int getMonth(){
		return this.month;
	}

	public boolean isJoined() {
		return joined;
	}

	public void setJoined(boolean joined) {
		this.joined = joined;
	}

	
	
	

}
